package cn.com.twoke.get_xml_data.service;

import cn.com.twoke.get_xml_data.service.impl.JsonGetXmlDataHandler;
import cn.com.twoke.get_xml_data.service.impl.LogGetXmlDataHandler;

import javax.swing.*;

public enum GetXmlDataType {
    LOG {
        @Override
        public GetXmlDataHandler get(JTextArea textArea, String outputDir) {
            if (this.handler == null) {
                this.handler = new LogGetXmlDataHandler(textArea);
            }
            return this.handler;
        }
    },
    JSON {
        @Override
        public GetXmlDataHandler get(JTextArea textArea, String outputDir) {
            if (this.handler == null) {
                this.handler = new JsonGetXmlDataHandler(outputDir);
            }
            return  this.handler;
        }
    };

    protected GetXmlDataHandler handler;

    public abstract GetXmlDataHandler get(JTextArea textArea, String outputDir);

}
